package com.buaa.dao.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.buaa.dao.InstitutionDao;
import com.buaa.utils.HibernateUtil;

/**
 * Title: 机构DAO实现 <br>
 * Description: <br>
 * Company: BUAA
 *
 * @author 伟宏
 * @date 2017年1月15日
 */
@Repository
@SuppressWarnings("unchecked")
public class InstitutionDaoImpl implements InstitutionDao {

	@Autowired
	private HibernateUtil hibernateUtil;

	@Override
	public List<Object> common1(String sql) {
		return hibernateUtil.findAllBySQL(sql, null);
	}

	@Override
	public List<Object[]> common2(String sql) {
		return hibernateUtil.findAllBySQL(sql, null);
	}

	@Override
	public List<Object> findAllType() {
		return hibernateUtil.findAllBySQL("SELECT name FROM institution_type", null);
	}

	@Override
	public List<Object> findAllKind() {
		return hibernateUtil.findAllBySQL("SELECT distinct kind FROM institution", null);
	}

	@Override
	public List<Object> findAllTech() {
		return hibernateUtil.findAllBySQL("SELECT name FROM technical_field WHERE level = 1", null);
	}

}
